package com.collect.discord.javacode;

import org.javacord.api.DiscordApi;
import org.javacord.api.DiscordApiBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ Author :hky
 * @ Date  : Created in 13:53 2022-09-17
 * @ Version discord
 * @ Decribtion : $
 */
//@Configuration
public class JavacodeConfig {
   // @Bean
    public void connetDiscord() {
        // Insert your bot's token here
        String proxyHost = "127.0.0.1";
        String proxyPort = "7890";
        System.setProperty("http.proxyHost", proxyHost);
        System.setProperty("http.proxyPort", proxyPort);
        // 对https也开启代理
        System.setProperty("https.proxyHost", proxyHost);
        System.setProperty("https.proxyPort", proxyPort);

        String token = "MTAyMTIzNjk4MTMxNDg5NTg4Mw.GzQoQx.5vkQ6qWpcFZl02DAqh2fsCKbwh57IaVTNCazdo";

        DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
        api.addMessageCreateListener(new RecieveMessageEvent());

    }
}
